package main;

import java.awt.geom.Point2D;

public class Utils {
	
	public static int pixelsPerInch = 30;
	
	public static double inchDist(int x1, int y1, int x2, int y2) {
		return Math.pow(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2), 0.5)/30;
	}
	
	public static double inchDist(Unit u1, Unit u2) {
		int x1 = u1.x;
		int x2 = u2.x;
		int y1 = u1.y;
		int y2 = u2.y;
		return Math.pow(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2), 0.5)/30;
	}
	
	public static double pixelDist(int x1, int y1, int x2, int y2) {
		return Math.pow(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2), 0.5);
	}
	
	public static boolean wound(int roll, int strength, int defense) {
		int[][] woundChart = {{4,5,5,6,6,7,7,7,7,7},
								{4,4,5,5,6,6,7,7,7,7},
								{3,4,4,5,5,6,6,7,7,7},
								{3,3,4,4,5,5,6,6,7,7},
								{3,3,3,4,4,5,5,6,6,7},
								{3,3,3,3,4,4,5,5,6,6},
								{3,3,3,3,3,4,4,5,5,6},
								{3,3,3,3,3,3,4,4,5,5},
								{3,3,3,3,3,3,3,4,4,5},
								{3,3,3,3,3,3,3,3,4,4}};
		if (woundChart[strength-1][defense-1] <= roll)
			return true;
		return false;
	}
}